//
//  DEWLikeComentModel.m
//  OtherDemo
//
//  Created by lianjie on 2018/7/29.
//  Copyright © 2018年 lianjie. All rights reserved.
//

#import "DEWLikeComentModel.h"

@implementation DEWLikeComentModel

-(NSAttributedString *)commentText
{
    NSString *liekText = @"";
    
    if ([self.kinds isEqualToString:@"2"]) {///点赞
        
        NSString *typeStr = [self backCommentDesc:self.kinds];
        
        liekText = [NSString stringWithFormat:@"赞了这条%@",typeStr];
    }else{
        
        if ([self.replyFlag isEqualToString:@"1"]) {
            ///对帖子回复
            liekText = self.content;
        }else{
            ///对人
            liekText = [NSString stringWithFormat:@"回复我：%@",self.content];
            
        }
    }
    NSMutableAttributedString *attributeStr = [[NSMutableAttributedString alloc]initWithString:liekText];
    
    [attributeStr setAttributes:@{NSFontAttributeName:[UIFont fontWithName:@"Heiti SC" size:16.0f],NSForegroundColorAttributeName:Color_33} range:NSMakeRange(0, liekText.length)];
    
    if ([self.kinds isEqualToString:@"2"] && [self.replyFlag isEqualToString:@"1"]) {
        [attributeStr setAttributes:@{NSFontAttributeName:[UIFont fontWithName:@"Heiti SC" size:16.0f],NSForegroundColorAttributeName:UIColorFromRGB(0xFF8900)} range:NSMakeRange(2, 1)];
    }
    return attributeStr;
}

- (NSString *)backCommentDesc:(NSString *)typeStr
{
    NSString *descStr = @"";
    NSInteger Tagg = [typeStr integerValue];
    if (Tagg == 1) {
        descStr = @"随手发发";
    }else if (Tagg == 2){
        descStr = @"邻里拼团";
    }else if (Tagg == 3){
        descStr = @"闲置二手";
    }else if (Tagg == 4){
        descStr = @"吐槽爆料";
    }else if (Tagg == 5){
        descStr = @"邻里活动";
    }else if (Tagg == 6){
        descStr = @"邻里合作";
    }else if (Tagg == 7){
        descStr = @"实名投票";
    }else if (Tagg == 8){
        descStr = @"赠红花";
    }else if (Tagg == 9){
        descStr = @"技能互助";
    }else{
        descStr = @"共享物品";
        
    }
    return descStr;
}

-(CGFloat)cellHeight
{
    CGSize attSize = [self.commentText boundingRectWithSize:CGSizeMake(DEWScreenWidth-Margin_15-65, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin context:nil].size;
    
    return 149+attSize.height;
    
}


@end
